Adding some more judges, here and there.
[and.git] / UVa / 11494 - Queen / 11494.cpp
blobd9ee488fb254eca50c5446bada5f9de1a78c1943
1 /*
2 Problem: 11494 - Queen
3 Author: Andrés Mejía-Posada
4 (http://blogaritmo.factorcomun.org)
6 */
8 using namespace std;
9 #include <algorithm>
10 #include <iostream>
11 #include <iterator>
12 #include <sstream>
13 #include <fstream>
14 #include <cassert>
15 #include <climits>
16 #include <cstdlib>
17 #include <cstring>
18 #include <string>
19 #include <cstdio>
20 #include <vector>
21 #include <cmath>
22 #include <queue>
23 #include <deque>
24 #include <stack>
25 #include <map>
26 #include <set>
28 #define D(x) cout << #x " is " << x << endl
30 int main(){
31 int a, b, c, d;
32 while (cin >> a >> b >> c >> d && (a+b+c+d)){
33 if (a == c && b == d) cout << "0\n";
34 else if (a == c || b == d || ((a-c==b-d) || (a-c==d-b))) cout << "1\n"; //Same row, column or diagonal
35 else cout << "2\n";
37 return 0;